import 'package:dk_flutter_base/dk_ui.dart';
import 'package:dk_flutter_module_sale/common/plugin/bean/bean_open_custom_media.dart';
import 'package:dk_flutter_module_sale/common/plugin/bean/bean_record_video.dart';

class UploadVideoBean {
  UploadConfigBean picUploadConfig;
  List<RecordVideoResultBean> videoList;

  UploadVideoBean({this.picUploadConfig, @required this.videoList});

  UploadVideoBean.fromJson(Map<String, dynamic> json) {
    this.picUploadConfig = json['picUploadConfig'] != null
        ? UploadConfigBean.fromJson(json['picUploadConfig'])
        : null;
    this.videoList = (json['videoList'] as List) != null
        ? (json['videoList'] as List)
            .map((i) => RecordVideoResultBean.fromJson(i))
            .toList()
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.picUploadConfig != null) {
      data['picUploadConfig'] = this.picUploadConfig.toJson();
    }
    data['videoList'] = this.videoList != null
        ? this.videoList.map((i) => i.toJson()).toList()
        : null;
    return data;
  }
}

class UploadVideoResultBean {
  List<UploadVideoSuccessBean> successList;
  List<RecordVideoResultBean> failList;

  UploadVideoResultBean({this.successList, this.failList});

  UploadVideoResultBean.fromJson(Map<String, dynamic> jsonContent) {
    this.successList = (jsonContent['successList'] as List) != null
        ? (jsonContent['successList'] as List)
            .map((i) => UploadVideoSuccessBean.fromJson(i))
            .toList()
        : null;
    this.failList = (jsonContent['failList'] as List) != null
        ? (jsonContent['failList'] as List)
            .map((i) => RecordVideoResultBean.fromJson(i))
            .toList()
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['successList'] = this.successList != null
        ? this.successList.map((i) => i.toJson()).toList()
        : null;
    data['failList'] = this.failList != null
        ? this.failList.map((i) => i.toJson()).toList()
        : null;
    return data;
  }
}

class UploadVideoSuccessBean {
  String videoPath;
  String videoCode;
  String imageCode;

  UploadVideoSuccessBean.fromJson(Map<String, dynamic> json) {
    this.videoPath = json['videoPath'];
    this.videoCode = json['videoCode'];
    this.imageCode = json['imageCode'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['videoPath'] = this.videoPath;
    data['videoCode'] = this.videoCode;
    data['imageCode'] = this.imageCode;
    return data;
  }
}
